Skip to content

Conversation

SentryMan
Copy link

@SentryMan SentryMan commented Oct 6, 2025

Now ExchangeImpl will default to having a separate attribute map for the request duration.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires a CSR request matching fixVersion 26 to be approved (needs to be created)

Issue

  • JDK-7105350: HttpExchange's attributes are the same as HttpContext's attributes (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27652/head:pull/27652
$ git checkout pull/27652

Update a local copy of the PR:
$ git checkout pull/27652
$ git pull https://git.openjdk.org/jdk.git pull/27652/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27652

View PR using the GUI difftool:
$ git pr show -t 27652

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27652.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 6, 2025

👋 Welcome back SentryMan! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 6, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Oct 6, 2025

@SentryMan The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 6, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 6, 2025

Webrevs

Copy link
Member

@Michael-Mc-Mahon Michael-Mc-Mahon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need a test for this as well

Comment on lines 63 to 65
private static final boolean perExchangeAttributes =
!System.getProperty("jdk.httpserver.attributes", "")
.equals("context");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property will have to be documented somewhere such as the jdk.httpserver module-info. But, I'm wondering if fairly obscure properties like this might be better off "buried" in the net.properties config file. I think there's a case for putting all such "compatibility" flags somewhere out of the way like that. If we were to do that, you would need to access the property using sun.net.NetProperties.

Any other views on this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can switch to sun.net.NetProperties if you so desire.

Copy link
Member

@Michael-Mc-Mahon Michael-Mc-Mahon Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think we should put the property in net.properties something like this:

  # Prior to JDK 26, the HttpExchange attribute map was shared with the enclosing HttpContext.
  # Since JDK 26, by default, exchange attributes are per-exchange and the context attributes must
  # be accessed by calling getHttpContext().getAttributes(). Uncomment this property to
  # restore the pre JDK 26 behavior.
  #
  # jdk.httpserver.attributes=context

Then I think we should add a sentence at the end of the jdk.httpserver module-info to say that additional
system/networking properties may be defined in net.properties

Copy link
Member

@dfuch dfuch Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That proposal sounds good to me. Documenting the compatibiity in net.properties makes sense.

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @Michael-Mc-Mahon that we will need a test to verify both old (with property set) and new behavior. Also this change will require a CSR and release notes.

Otherwise the proposed solution looks good. I believe it meets what a user reading the documentation would expect: get/set attributes on context get/set attributes for the whole context and may be observed by all exchanges that operate on this context. get/set attribute on the exchange get/set attributes whose scope is limited to that particular exchange.

This was a long standing issue and I'm happy to see it fixed. Thanks for driving that @SentryMan and @Michael-Mc-Mahon !

Comment on lines 63 to 65
private static final boolean perExchangeAttributes =
!System.getProperty("jdk.httpserver.attributes", "")
.equals("context");
Copy link
Member

@dfuch dfuch Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That proposal sounds good to me. Documenting the compatibiity in net.properties makes sense.

@openjdk
Copy link

openjdk bot commented Oct 8, 2025

@SentryMan core-libs has been added to this pull request based on files touched in new commit(s).

@dfuch
Copy link
Member

dfuch commented Oct 8, 2025

/csr needed

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Oct 8, 2025
@openjdk
Copy link

openjdk bot commented Oct 8, 2025

@dfuch has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@SentryMan please create a CSR request for issue JDK-7105350 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@SentryMan
Copy link
Author

@SentryMan please create a CSR request for issue JDK-7105350 with the correct fix version.

How should I go about creating a CSR? The FAQ on this page says that I need JIRA access (I don't have that)

@dfuch
Copy link
Member

dfuch commented Oct 8, 2025

@SentryMan note: WRT to creating a CSR your sponsor will handle that if you do not have a JBS account. Let's wait until this PR has been approved and everyone is happy with the API doc / behaviours changes.

java.net.http,
jdk.naming.dns;
jdk.naming.dns,
jdk.httpserver;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if we could avoid giving the jdk.httpserver module access to the sun.net.* package.

@dfuch @Michael-Mc-Mahon Are you sure that net.properties is the right place for this?

Copy link
Member

@dfuch dfuch Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlanBateman I hadn't realised that the HttpServer didn't already have access to sun.net.* - and I agree that it would be better if we did not add such an access. That said - the new property is a compatibility property - and documenting in module-info seemed a bit too much - so out of the way in net.properties seemed like an appealing place to add it.

Another possibility could be to document it only in the release notes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall I revert the change and leave as a system property?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs [email protected] csr Pull request needs approved CSR before integration net [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants